<!DOCTYPE html>
<html lang="en">
<head>

    <meta charset="UTF-8">


    <!-- 地址栏显示 -->
    <link rel="Shortcut Icon" href="/static/images/hospital.ico" type="image/x-icon"/>
    <!-- 收藏栏也显示 -->
    <link rel="Bookmark" href="/static/images/hospital.ico" type="image/x-icon"/>

    <link href="/static/sb-admin-2/vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
    <!--    <link th:href="@{https://fonts.loli.net/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i}"
              rel="stylesheet">-->

    <!-- Custom styles for this template-->
    <link href="/static/sb-admin-2/css/sb-admin-2.css" rel="stylesheet">

    <link href="/static/sb-admin-2/bootstrap/bootstrap-table.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="/static/csss/sweetalert.css">
    <title>门诊收费</title>
    <link rel="stylesheet" type="text/css" href="/static/csss/chosen.min.css"/>
    <link rel="stylesheet" type="text/css" href="/static/csss/mcss/mcss_outpatientToll.css"/>
    <link rel="stylesheet" type="text/css" href="/static/csss/mcss/mcss_notice.css"/>
    <link type="text/css" rel="stylesheet" href="/static/csss/preloader.css">
    <link rel="stylesheet" href="/static/layui/css/layui.css" media="all">
</head>
<body>
<!--正文-->
<div>
    <div class="card shadow mb-4" style="margin-left: 2.5%">

        <div class="card-header py-3" style="display: flex;">
            <h6 class="m-0 font-weight-bold text-primary">划价收费</h6>
            <button class="btn btn-info mybutton-toll" onclick="printPrescription()">打印</button>
        </div>

        <div class="card-body toll">

            <div class="split split-horizontal card prescription" id="myprescription">

                <div style="display: flex">
                    <h4 style="font-family: STLiti,serif;color: #2C9FAF">SHOSPITAL</h4>

                    <h2>门诊处方笺</h2>

                    <div style="font-size: 15px;margin-left: 26%">
                        <div id="nowDate"></div>
                    </div>

                </div>


                <div class="textbox">

                    处方号<input type="text" id="prescriptionNum" style="width: 170px"
                              readonly="readonly">
                    科室<input type="text" id="department" style="width: 110px" readonly="readonly">&emsp;
                    日期<input type="text" id="createDate" style="width: 133px" readonly="readonly">
                    <br> <br>
                    姓名<input type="text" id="name" style="width: 110px" readonly="readonly">&emsp;
                    性别<input type="text" id="sex" style="width: 90px" readonly="readonly">
                    民族<input type="text" id="nationality" style="width: 90px" readonly="readonly">
                    年龄<input type="text" id="age" style="width:90px" readonly="readonly">
                    <br> <br>
                    初步诊断<input type="text" id="diagnosisResult" readonly="readonly" style="width:505px">
                </div>

                <div style="display: flex">
                    <div style="font-size: 1.1rem">
                        <img style="width: 70px;height: 70px;margin-left: 60px;"
                             src="/static/images/icon/prescription.png">
                    </div>


                </div>

                <div>
                    <div id="prescription" class="prescription-1"></div>

                    <div style="margin: 0 70px 0 60px">
                        <div style="display: flex;">
                            <div style="display: flex;width: 430px">
                                <div>
                                    医嘱
                                </div>
                                <div style="margin-left: 10px" id="medicalOrder"></div>
                            </div>
                            <div style="display: flex;">
                                <div>医师</div>
                                <div>
                                    <input type="text" id="doctorName" style="width:80px"
                                           readonly="readonly">
                                </div>
                            </div>

                        </div>
                        <hr>
                        <div style="display: flex;">
                            <div style="display: flex">
                                <div>药费</div>
                                <div>
                                    <input type="text" id="drugCost" style="width:80px" readonly="readonly">
                                </div>
                            </div>
                            <div style="display: flex;margin-left: 20px">
                                <div>检查费</div>
                                <div>
                                    <input type="text" id="examinationCost" style="width:80px"
                                           readonly="readonly">
                                </div>
                            </div>
                            <div style="margin-left: 170px">
                                签字:
                            </div>


                        </div>
                    </div>
                </div>

            </div>

            <div class="split split-horizontal tolloperation" id="tolloperation">

                <div class="CardIdInfor">
                    卡号<input type="text" style="width: 140px"  id="cardId">
                    <div class="my-tooltip">
                        <img class="png" src="/static/images/icon/notice.png">
                        <div class="tooltip">手动输入就诊卡号后，只需点击最右侧搜索按钮，选择收费状态便可查询。读取就诊卡需配合IC读卡器来使用！</div>
                    </div>

                    <div style="margin-left: 50px">
                        收费状态<select class='tollStatus' data-placeholder=' '>

                        <option value=""></option>

                        <option value="0">未收费</option>

                        <option value="1">已收费</option>

                    </select>
                    </div>
                    <div class="mybtn1">
                        <button class="btn btn-info" onclick="findAllMedicalRecord()">
                            <img class="png" src="/static/images/icon/search.png">
                        </button>
                    </div>
                </div>
                <div class="toll_table">
                    <table id="demo" lay-filter="test"></table>
                </div>


                <div style="margin: 70px 0 0 100px">
                    <div style="display: flex;">
                        <div>
                            合计：
                        </div>
                        <div>
                            <input type="text" id="total" style="width:90px" readonly="readonly">
                        </div>
                        <div style="margin-left: 30px">
                            付款方式<select class='payType' data-placeholder=' '>

                            <option value=""></option>

                            <option value="现金">现金</option>

                            <option value="支付宝">支付宝</option>

                        </select>
                        </div>
                    </div>
                </div>

                <div class="textbox_2" style="display: flex">
                    <div style="width: 60%">
                        <div id="money" style="display: none">
                            实付<input type="text" id="payMoney" style="width: 120px"
                                     oninput="getChange()">元&emsp;&emsp;&emsp;
                            找零<input type="text" id="Change" style="width: 100px;color: red"
                                     readonly="readonly">元

                        </div>

                        <div id="apay" style="display: none;margin-left: 40%">
                            <img style="width: 100px;height: 100px;"
                                 src="/static/images/icon/apay.jpg">
                        </div>
                    </div>
                    <div class="mybtn3">

                        <button class="btn btn-info" onclick="saveTollInfo()">提交信息</button>

                    </div>

                </div>

            </div>

        </div>
    </div>
</div>
<div>
    <div>

        <script type="text/javascript" src="/static/sb-admin-2/vendor/jquery/jquery.min.js"></script>

        <script type="text/javascript" src="/static/sb-admin-2/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>

        <!-- Core plugin JavaScript-->
        <script type="text/javascript" src="/static/sb-admin-2/vendor/jquery-easing/jquery.easing.min.js"></script>

        <!-- Custom scripts for all pages-->
        <script type="text/javascript" src="/static/sb-admin-2/js/sb-admin-2.min.js"></script>
        <script type="text/javascript" src="/static/jss/sweetalert-dev.js"></script>
    </div>
    <script type="text/javascript" src="/static/jss/jquery.preloader.min.js"></script>
    <script type="text/javascript" src="/static/jss/chosen.jquery.min.js"></script>
    <script type="text/javascript" src="/static/jss/split.min.js"></script>
    <script type="text/javascript" src="/static/jss/jquery.jqprint-0.3.js"></script>
    <script src="/static/sb-admin-2/bootstrap/bootstrap-table.min.js"></script>
    <script src="/static/sb-admin-2/bootstrap/bootstrap-table-zh-CN.js"></script>
    <script type="text/javascript" src="/static/jss/mjs/mjs_outpatientToll.js"></script>
    <script type="text/javascript" src="/static/jss/Print.js"></script>
</div>
</body>
<script type="text/jsp" id="barDemo">
     <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="check">选择</a>
</script>
<script src="/static/js/jquery-3.3.1.js"></script>
<script src="/static/layui/layui.js"></script>
<script src="/static/sb-admin-2/vendor/jquery/jquery.min.js"></script>
<script>
    /*获取门诊收费基础信息*/
    function findAllMedicalRecord(){
        layui.use(['table', 'layer', 'jquery'], function () {
            var table = layui.table;
            var layer = layui.layer;
            var $ = layui.jquery;
            //第一个实例
            table.render({
                elem: '#demo'
                , height: document.body.clientHeight - 180
                , url: '/medicalRecord/findAll' //数据接口
                /*   , url: '/h/showhospital' //数据接口*/
                , page: true
                , id: 'testReload'
                , cols: [[ //表头
                    {field: 'id', title: '序号', sort: true}
                    , {field: 'create_datetime', title: '门诊时间', sort: true}
                    , {field: 'department', title: '科室', sort: true,
                        templet: function (d) {
                            return d.department.name;
                        }
                    }
                    , {field: 'register', title: '挂号类型', sort: true,
                        templet: function (d) {
                            return d.register.register_type;
                        }
                    }
                    , {field: 'register', title: '医生名称', sort: true,
                        templet: function (d) {
                            return d.register.doctor;
                        }
                    }
                    , {field: 'tolltakedrug_no', title: '处方号', sort: true
                    }
                    , {field: 'right', title: '操作', toolbar: '#barDemo'}
                ]]
                , toolbar: '#toolbar',//表格头信息
                parseData: function (rs) {//数据格式解析
                    console.log(rs);
                    if (rs.code == 200) {
                        return {
                            "code": rs.code,
                            "msg": rs.msg,
                            "count": rs.date.total,
                            "data": rs.date.list
                        }
                    }
                },
                response: {	// 设置响应码
                    statusCode: 200 //规定成功的状态码，默认：0
                }
            });
            //监听行事件
            table.on('tool(test)', function (obj) {
                var data = obj.data;
                if (obj.event === 'detail') {
                    open("详情页面", "/view/contract/detail.html?hid=" + data.hid);
                } else if (obj.event === 'check') {
                    $.ajax({
                        type: "POST",
                        url: "/patient/findById",
                        data: {card_id: data.id},
                        dataType: "json",
                        success: function (data) {
                            console.log(data)
                            if (data.code == 200) {
                                $("#name").val(data.date.name);
                                $("#sex").val(data.date.sex);
                                $("#nationality").val(data.date.nationality);
                                $("#age").val(new Date().getFullYear() - data.date.birthday.split("-")[0]);
                                $("#prescriptionNum").val(prescriptionNum);
                                $("#createDate").val(data.date.create_datetime);
                                // $("#department").val(department);
                                //$("#diagnosisResult").val(data.date.diagnosisResult);
                                //$("#medicalOrder").html(data.date.medicalOrder);
                                // $("#drugCost").val(data.date.drugCost);
                                //$("#doctorName").val(doctorName);
                                // $("#prescription").html(data.date.prescription);
                                //  $("#examinationCost").val(data.date.examinationCost);
                                // $("#nowDate").html(data.date.nowDate);
                                // $("#total").val(data.date.drugCost)
                            } else {
                                layer.msg(data.date.msg)
                            }
                        },
                        error: function (data) {
                            alert("出现错误");
                            return false;
                        }
                    }) //ajax结束
                    layer.close(index);
                } else if (obj.event === 'edit') {
                    open("文件修改页面", "/view/hospital/edit.html?hid=" + data.hid);
                }
            });
        });
    }
</script>
</html>